<?php #//AJAX PHP PENNY AUCTION v.1.1

#///////////////////////////////////////////////////////////
#//  COPYRIGHT 2009 Aaron Helmlinger ALL RIGHTS RESERVED  //
#///////////////////////////////////////////////////////////
include "./includes/config.inc.php";


$TIME = mktime(date("H")+$SETTINGS['timecorrection'],date("i"),date("s"),date("m"), date("d"),date("Y"));
$NOW = date("YmdHis",$TIME);

                        $query_title1 = "select email from PHPAUCTIONXL_users where id=1";
                             $query_title2 =  mysql_query ($query_title1);
                                $paypal_email = mysql_result($query_title2,0,"email");

     
      $query33 = mysql_fetch_array(mysql_query("SELECT bid_pack_free_bids,bid_pack_free_bids_percentage FROM PHPAUCTIONXL_version_1_3 WHERE id=1"));

   $bid_pack_free_bids1 = $query33['bid_pack_free_bids'];
  $bid_pack_free_bids_percentage1 = $query33['bid_pack_free_bids_percentage'];
 



$auction_id = intval($_GET['id']); 
   $bid_pack_id = intval($_GET['bpid']);
$id2 = $_SESSION["PHPAUCTION_LOGGED_IN"];

           $query = "select * from PHPAUCTIONXL_bid_packs where id=$bid_pack_id ";
$result_numbids = mysql_query ($query);
$num_auction2 = mysql_num_rows($result_numbids);

                               $query_settings = "select * from PHPAUCTIONXL_version_2_1 where id='1'";
                             $query_settings2 =  mysql_query ($query_settings);
                                $nat_tax_rate2 = mysql_result($query_settings2,0,"nat_tax_rate");                             
                                 $tax_state2 = mysql_result($query_settings2,0,"tax_state"); 
                                   
                                   
                                      $query33 = mysql_fetch_array(mysql_query("SELECT tax_rate_percentage,average_bid_price FROM PHPAUCTIONXL_version_1_3 WHERE id=1"));
                                   $tax_rate_percentage1 = $query33['tax_rate_percentage'];
                                  $average_bid_price2 = $query33['average_bid_price'];
        
                                   
                                    $query_settings = "select * from PHPAUCTIONXL_users where id=$id2";
                             $query_settings2 =  mysql_query ($query_settings);
                                $users_state = mysql_result($query_settings2,0,"prov"); 
                             
                             
                             // echo  $users_state; 
                    //   echo   $nat_tax_rate2;
                      //   echo   $tax_state2;
                      //     echo  $tax_rate_percentage1;
 $ii = 0;
                      
       

while($ii < $num_auction2) {




     $bid_pack_id 	= mysql_result($result_numbids,$ii,"id");
    $bid_pack_title 	= mysql_result($result_numbids,$ii,"title");
     $bid_pack_price 	= mysql_result($result_numbids,$ii,"price"); 
            $bid_pack_bids 	= mysql_result($result_numbids,$ii,"bids");
       $bid_pack_note1 	= mysql_result($result_numbids,$ii,"note1");       
          $bid_pack_note2 	= mysql_result($result_numbids,$ii,"note2"); 


  

   $bid_pack_html .= "<DIV class=BID_PACK_BOX ><FIELDSET>   <LEGEND><span class=BID_PACK_TITLE_TEXT >".$bid_pack_title."</span></legend>";
   $bid_pack_html .= "<span class=BID_PACK_NOTE1_TEXT >".$bid_pack_note1."</span><br> ";
   $bid_pack_html .= "<A HREF=buybids_paypal_create.php?id=".id."&bbpid=".$bid_pack_id.">";
   $bid_pack_html .= "<span class=BID_PACK_BID_TEXT >".$bid_pack_bids." Bids</span><BR>";
   $bid_pack_html .= "<span class=BID_PACK_PRICE_TEXT >".$currency_symbol.$bid_pack_price." ".$currency."<BR></a></span>";
   $bid_pack_html .= "<span class=BID_PACK__NOTE2_TEXT >".$bid_pack_note2."</span>  </FIELDSET></DIV>";
                     
       
      

     
$ii++;

}

$bid_pack = $bid_pack_bids;

if ( $bid_pack_free_bids_percentage1 > 0 ) {
          
     $bid_pack = $bid_pack_bids * ( 1 + $bid_pack_free_bids_percentage1 ); 
        $bid_pack =  $bid_pack + .5;
                     }
                     
                     if ( $bid_pack_free_bids1 > 0 ) {
          
     $bid_pack = $bid_pack_bids + $bid_pack_free_bids1; 

                     }

       
    $bid_pack = round($bid_pack, 0);


$item_name .= $bid_pack_title;

    
$price = $bid_pack_price;

       $item_number = "User-Id:";
  $item_number .=     $id2;
  $item_number .=     ":Bid-Pack:";
  $item_number .=     $bid_pack;
  $item_number .=     ":Price:";
  $item_number .=     $price;  





include "header.php";
include phpa_include("template_buybids_paypal_php.html");
include "footer.php";

?>

       